// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   PageUtils.java

package dale.web;


public class PageUtils
{

    public PageUtils()
    {
    }

    public static String getPagerHTML(int totalRows, int currentPage)
    {
        int totalPages = (int)Math.ceil((double)totalRows / 10D);
        int firstPage = currentPage - (currentPage - 1) % 10;
        int lastPage = firstPage + 9;
        if(lastPage > totalPages)
            lastPage = totalPages;
        StringBuffer buffer = new StringBuffer();
        for(int i = firstPage; i <= lastPage; i++)
            if(i == currentPage)
                buffer.append((new StringBuilder("<b>[")).append(i).append("]</b>").toString());
            else
                buffer.append(makeUpLinkElement(i, (new StringBuilder("[")).append(i).append("]").toString()));

        if(firstPage != 1)
            buffer.insert(0, makeUpLinkElement(firstPage - 1, "\u25C0"));
        if(lastPage < totalPages)
            buffer.append(makeUpLinkElement(lastPage + 1, "\u25B6"));
        return buffer.toString();
    }

    static String makeUpLinkElement(int no, String icon)
    {
        return (new StringBuilder("<a href=\"javascript:turnPage(")).append(no).append(");\">").append(icon).append("</a>").toString();
    }

    public static final int RECORD_SIZE = 10;
    public static final int BLOCK_SIZE = 10;
}
